import request from '@/utils/request'

var baseUrl = '/type'

export function getById(id) {
  return request({
    url: baseUrl + '/get-by-id',
    method: 'get',
    params: { id }
  })
}

export function fetchList(query) {
  return request({
    url: baseUrl + '/get-list-page',
    method: 'post',
    data: query
  })
}

export function createType(data) {
  return request({
    url: baseUrl + '/save',
    method: 'post',
    data
  })
}

export function updateType(data) {
  return request({
    url: baseUrl + '/update',
    method: 'post',
    data
  })
}

export function deleteOneType(id) {
  return request({
    url: baseUrl + '/delete-one',
    method: 'get',
    params: { id }
  })
}

export function deleteType(ids) {
  return request({
    url: baseUrl + '/delete',
    method: 'get',
    params: { ids }
  })
}

export function getAllLevelOneJson() {
  return request({
    url: baseUrl + '/get-All-level-one-Json',
    method: 'get',
    params: {}
  })
}

export function getAllLevelTwoJsonByLevelOneId(id) {
  return request({
    url: baseUrl + '//get-All-level-two-Json-by-level-one-id',
    method: 'get',
    params: { id }
  })
}

export function getAllLevelTwoJson() {
  return request({
    url: baseUrl + '/get-All-level-two-Json',
    method: 'get',
    params: {}
  })
}
